import { Controller, Get, Req } from '@nestjs/common';
import { Crud, CrudController, Override, ParsedRequest, ParsedBody, CrudRequest } from '@nestjsx/crud';
import { Ad } from "../../entities/ad.entities";
import { AdService } from "../../services/ad/ad.service";
import { ApiTags, ApiBody} from '@nestjs/swagger';
import { Request } from 'express';

@Crud({
  model:{
    type:Ad,
  },
  query:{
    join:{
      adPosition:{
        //allow:["id"],
        exclude:["id","desc"],
        eager:true
      }
    },
    exclude:["ad_position_id","media_type","enabled"],
    filter:[
      {
        field:"enabled",
        operator:"$eq",
        value:1
      }
    ]
  }
})
@ApiTags('ad')
@Controller('api/ad')
export class AdController{
  constructor(
    public service:AdService
  ){}
}
